//
//  CMDBAssociateFlowLayout.swift
//  CMDB
//
//  Created by 王磊 on 09/05/2017.
//  Copyright © 2017 CMDB. All rights reserved.
//

import UIKit

public let Associate_Section_Header_Height: CGFloat = 60

public let Associate_Section_Footer_Height: CGFloat = 88 * CMDB_Rate * 3

public let Associate_Section_Inset_Margin: CGFloat = 30 * CMDB_Rate

public let Associate_Min_Space: CGFloat = 30 * CMDB_Rate

public let Associate_Item_Title_Height: CGFloat = 50 * CMDB_Rate

public let Associate_Item_Label_Height: CGFloat = 50 * CMDB_Rate

public let Associate_Item_Width: CGFloat = (CMDB_Screen_Width - Associate_Min_Space * 2 - Associate_Section_Inset_Margin * 2) / 3

public let Associate_Item_Height: CGFloat = Associate_Item_Width / 3 * 4 + Associate_Item_Title_Height + Associate_Item_Label_Height



class CMDBAssociateFlowLayout: UICollectionViewFlowLayout {
    
    override func prepareLayout() {
        
        guard let collectionView = collectionView else {
            
            return
        }
        
        headerReferenceSize = CGSizeMake(CGRectGetWidth(collectionView.bounds), Associate_Section_Header_Height)
        
        footerReferenceSize = CGSizeMake(CGRectGetWidth(collectionView.bounds), Associate_Section_Footer_Height)
        
        sectionInset = UIEdgeInsetsMake(0, Associate_Section_Inset_Margin, 0, Associate_Section_Inset_Margin)
        
        minimumLineSpacing = Associate_Min_Space
        
        minimumInteritemSpacing = Associate_Min_Space
    }
    
}
